Course Contents

Appendix 4 HTML and XHTML

Recently, the World Wide Web Consortium has been involved in developing an XML based version of HTML, called XHTML. HTML and XHTML are essentially the same language, with some minor syntactic differences. Here we discuss briefly a few of the most relevant ones.

Case sensitivity

HTML was and remains a case insensitive language. That means all of the following words are identical, HEAD, head, Head. So using <HEAD>, <head> or <Head> are all equivalent in HTML. By convention, HTML uses all upper case for element names (so in this case, the convention would be to use <HEAD>) while using lowercase for attribute names (so we would write id="element1").

In XHTML, all element names and attribute names must be in lowercase. This is because XHTML, as an XML application is case sensitive. In XHTML, only <head> is correct, and must be used. Similarly, for an attribute, we would only write, id, not ID or Id.

Layout Master does not change existing code. However, when you use Layout Master to create new elements it does not follow the HTML convention. Rather it uses lowercase for element and attribute names and values.

HTML versus XHTML syntax

Let's just recap this issue of HTML versus XHTML. The languages are essentially identical, with a small number of grammatical differences which are easy to accommodate.

  1. empty elements must use " />" to close. The space between the last attribute and the / is for backwards compatibility with older HTML browsers. So for example, <img> elements need to close with a />.
  2. All non empty elements require end tags

Layout Master does not change existing HTML or XHTML code. However, when you use Layout master to create new elements it will create them as HTML or XHTML depending on what you have set in the preferences.

For example, when the option you select is to create XHTML elements, Layout Master ensures that empty elements close with " />". For example, you'll find image elements have the following form

<img src="image_source.gif" />